NotificationManagerCompat
Compatibility library for NotificationManager with fallbacks for older platforms.
To use this class, call the static function from to get a NotificationManagerCompat object, and then call one of its methods to post or cancel notifications.
Types
Link copied to clipboard
Link copied to clipboard
Helper class which encapsulates a Notification, its id, and optionally a tag, for use when batch-posting a number of notifications.
Properties
Link copied to clipboard
Intent action to register for on a service to receive side channel notifications.
Link copied to clipboard
Notification extras key: if set to true, the posted notification should use the side channel for delivery instead of using notification manager.
Link copied to clipboard
Default notification importance: shows everywhere, allowed to makes noise, but does not visually intrude.
Link copied to clipboard
Higher notification importance: shows everywhere, allowed to makes noise and peek.
Link copied to clipboard
Low notification importance: shows everywhere, but is not intrusive.
Link copied to clipboard
Highest notification importance: shows everywhere, allowed to makes noise, peek, and use full screen intents.
Link copied to clipboard
Min notification importance: only shows in the shade, below the fold.
Link copied to clipboard
A notification with no importance: shows nowhere, is blocked.
Link copied to clipboard
Value signifying that the user has not expressed an importance.
Link copied to clipboard
Interruption filter constant - Alarms only interruption filter - all notifications except those of category CATEGORY_ALARM are suppressed.
Link copied to clipboard
Interruption filter constant - Normal interruption filter - no notifications are suppressed.
Link copied to clipboard
Interruption filter constant - No interruptions filter - all notifications are suppressed and all audio streams (except those used for phone calls) and vibrations are muted.
Link copied to clipboard
Interruption filter constant - Priority interruption filter - all notifications are suppressed except those that match the priority criteria.
Link copied to clipboard
Interruption filter constant - returned when the value is unavailable for any reason.
Functions
Link copied to clipboard
Returns whether notifications from the calling package are not blocked.
Link copied to clipboard
Returns whether the calling app can send fullscreen intents.
Link copied to clipboard
Creates a notification channel that notifications can be posted to.
Link copied to clipboard
Creates a group container for NotificationChannel objects.
Link copied to clipboard
Creates multiple notification channel groups.
Link copied to clipboard
open fun createNotificationChannelGroupsCompat(@NonNull groups: List<NotificationChannelGroupCompat>)
Creates multiple notification channel groups.
Link copied to clipboard
Creates multiple notification channels that different notifications can be posted to.
Link copied to clipboard
Creates multiple notification channels that different notifications can be posted to.
Link copied to clipboard
Deletes the given notification channel.
Link copied to clipboard
Deletes the given notification channel group, and all notification channels that belong to it.
Link copied to clipboard
Deletes notification channels for which ids are NOT given.
Link copied to clipboard
Get a NotificationManagerCompat instance for a provided context.
Link copied to clipboard
Recover a list of active notifications: ones that have been posted by the calling app that have not yet been dismissed by the user or canceled by the app.
Link copied to clipboard
Gets the current notification interruption filter.
Link copied to clipboard
Link copied to clipboard
Returns the user specified importance for notifications from the calling package.
Link copied to clipboard
Returns the notification channel settings for a given channel id.
open fun getNotificationChannel(@NonNull channelId: String, @NonNull conversationId: String): NotificationChannel
Returns the notification channel settings for a given channel and conversation id.
Link copied to clipboard
Returns the notification channel settings for a given channel id.
open fun getNotificationChannelCompat(@NonNull channelId: String, @NonNull conversationId: String): NotificationChannelCompat
Returns the notification channel settings for a given channel and conversation id.
Link copied to clipboard
Returns the notification channel group settings for a given channel group id.
Link copied to clipboard
open fun getNotificationChannelGroupCompat(@NonNull channelGroupId: String): NotificationChannelGroupCompat
Returns the notification channel group settings for a given channel group id.
Link copied to clipboard
Returns all notification channel groups belonging to the calling app or an empty list on older SDKs which don't support Notification Channels.
Link copied to clipboard
Returns all notification channel groups belonging to the calling app or an empty list on older SDKs which don't support Notification Channels.
Link copied to clipboard
Returns all notification channels belonging to the calling app or an empty list on older SDKs which don't support Notification Channels.
Link copied to clipboard
Returns all notification channels belonging to the calling app or an empty list on older SDKs which don't support Notification Channels.
Link copied to clipboard
open fun notify(@NonNull notificationWithIdAndTags: List<NotificationManagerCompat.NotificationWithIdAndTag>)
Post a number of notifications, to be shown in the status bar, stream, etc.
Post a notification to be shown in the status bar, stream, etc.